package com.kwedding.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.kwedding.dto.web.RequestWebAddBrandMedia;
import com.kwedding.dto.web.RequestWebMediaList;
import com.kwedding.dto.web.RequestWebUpDownBrandMedia;
import com.kwedding.dto.web.RequestWebUpdateBrandMedia;
import com.kwedding.dto.web.ResponseWebMediaList;
import com.kwedding.service.web.WebMediaService;
import com.kwedding.util.BackJson;
import com.kwedding.util.JsonBack;
import com.kwedding.util.JsonBackBase;
import com.kwedding.util.LoggerParent;
import com.kwedding.util.Resp_PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Controller
@RequestMapping("rest/web/media")
@Api(tags = "品牌视频管理")
public class WebMediaController extends LoggerParent {

	@Autowired
	private WebMediaService webMediaService;

	@ApiOperation(" 获取品牌视频列表")
	@ResponseBody
	@RequestMapping(value = "getBrandMediaList", method = { RequestMethod.POST })
	private JsonBackBase<Resp_PageInfo<ResponseWebMediaList>> getBrandMediaList(
			@RequestBody RequestWebMediaList requestWebMediaList) {
		return BackJson.successObj(webMediaService.getBrandMediaList(requestWebMediaList));
	}

	@ApiOperation(" 添加品牌视频")
	@ResponseBody
	@RequestMapping(value = "insertBrandMedia", method = { RequestMethod.POST })
	private JsonBack insertBrandMedia(@RequestBody RequestWebAddBrandMedia addBrandMedia) {
		webMediaService.insertBrandMedia(addBrandMedia);
		return BackJson.success();
	}

	@ApiOperation("修改品牌视频")
	@ResponseBody
	@RequestMapping(value = "updateBrandMedia", method = { RequestMethod.POST })
	private JsonBack updateBrandMedia(@RequestBody RequestWebUpdateBrandMedia webUpdateBrandMedia) {
		webMediaService.updateBrandMedia(webUpdateBrandMedia);
		return BackJson.success();
	}

	@ApiOperation("上下架品牌视频")
	@ResponseBody
	@RequestMapping(value = "upDownBrandMedia", method = { RequestMethod.POST })
	private JsonBack upDownBrandMedia(@RequestBody RequestWebUpDownBrandMedia upDownBrandMedia) {
		webMediaService.upDownBrandMedia(upDownBrandMedia);
		return BackJson.success();
	}

}
